<?php
	require_once 'Connect.class.php';
	require_once 'DanhMuc.class.php';
	/**
	* 
	*/

	class KhenThuong extends DanhMuc
	{
		private $heSo;
		
		public function __construct()
		{
			# code...
		}

		public function setHeSo($hs){
			$this->heSo=$hs;
		}

		public function getHeSo(){
			return $this->heSo;
		}

		public function getInfo($maLoaiKT){

			$conn= new Connect();

			$conn->Query("SELECT * FROM tbl_loai_khen_thuong WHERE maLKT='".$maLoaiKT."'; ");	

			while ($row=$conn->Fetch()) {	

				$this->ma=$row['maLKT'];
				
				$this->ten=$row['tenLKT'];

				$this->heSo=$row['heSo'];
			}
			// dong ket noi
			$conn->close();
		}

		public function them(){

			$sql="INSERT INTO tbl_loai_khen_thuong(tenLKT,heSo) values('".$this->ten."','".$this->heSo."')";

			$conn=new Connect();

			$conn->Query($sql);

			$conn->close();
			
		}

		public function xoa(){
			$sql="DELETE FROM tbl_loai_khen_thuong WHERE maLKT='".$this->ma."'";
			$conn=new Connect();
			$conn->Query($sql);
			$conn->close();

		}
		public function capnhat(){
			$sql="UPDATE tbl_loai_khen_thuong SET tenLKT='".$this->ten."',heSo=".$this->heSo." WHERE maLKT='".$this->ma."'";
			$conn=new Connect();
			$conn->Query($sql);
			$conn->close();
		}

		//---hàm lấy danh sách chức vụ
		public function ds(){
			$ds=array();
			$conn= new Connect();
			$conn->Query("SELECT * FROM tbl_loai_khen_thuong");
			$index=0;
			while ($row=$conn->Fetch()) {
				$kt= new KhenThuong();
				$kt->setMa($row['maLKT']);
				$kt->setTen($row['tenLKT']);
				$kt->setHeSo($row['heSo']);
				$ds[$index]=$kt;
				$index++;
			}
			// dong ket noi
			$conn->close();
			return $ds;
		}
	}
?>

